<?php
namespace Apis\Controller;
use Think\Controller;

class ArticleController extends MobileBaseController {

    //分类详情页
    public function detail(){
        $first=M('article_cat')->where('cat_id='.$_GET['cat_id'])->find();
        $name=$first['cat_name'];
        //查询这个下面的小分类
        $article_cat=M('article_cat')->where('parent_id='.$_GET['cat_id'])->order('sort_order desc')->select();
            if($article_cat){
                if($_GET['id']){
               $find=M('article')->where('cat_id='.$_GET['id'])->find();
               $ty=$_GET['id'];
            }else{
                $find=M('article')->where('cat_id='.$article_cat[0]['cat_id'])->find();
                $ty=$article_cat[0]['cat_id'];
            }
            $find['content']=htmlspecialchars_decode($find['content']);

        }else{
            $article_cat=array();
        }

        $this->assign('article_cat',$article_cat);
        $this->assign('ty',$ty);
        $this->assign('name',$name);
        $this->assign('cat_id',$_GET['cat_id']);
        $this->assign('find',$find);
        $this->display();
    }
    //维修介绍
    public function repair(){
        $article_id = I('article_id',1239);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }
    //租赁介绍
    public function lease(){
        $article_id = I('article_id',1240);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }

    //培训介绍
    public function train(){
        $article_id = I('article_id',1241);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }
    //销售介绍
    public function sale(){
        $article_id = I('article_id',1242);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }

    //拍照介绍
    public function photo(){
        $article_id = I('article_id',1243);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }

    //联系我们
    public function contact(){
        $article_id = I('article_id',1244);
        $article = D('article')->where("article_id=$article_id")->find();
        $this->assign('article',$article);
        $this->display();
    }
}
